<?php
include '../class/class.user.php';
include '../class/class.kewenangan.php';

if(isset($_REQUEST['list_user'])){
	session_start();
	$id_user=$_SESSION['id_user'];
	$id_kewenangan=$_SESSION['id_kewenangan'];
	$userDao= new UserDao();

	$user=$userDao->getAllUser($id_user,$id_kewenangan);
	$kewenanganDao=array();
	$userDaoNip=array();

	$data=array();
	$i=0;
	foreach($user as $row){
		$kewenanganDao[$i]=new kewenanganDao();
		$userDaoNip[$i]= new UserDao();
		$data[$i]=array(
		'id_user' => $row['id_user'],
		'nip'=> $row['nip'],
		'id_parent_user' => $userDaoNip[$i]->getNip($row['id_parent_user']),
		'id_kewenangan' => $kewenanganDao[$i]->getKewenangan($row['id_kewenangan']),
		'status_aktif' => $row['status'],
		);
		$i++;
	}
	
	echo json_encode($data);
}

?>